library(tidyverse)
library(sf) # For spatial data
library(mapview) # To quickly map
The dataset for this activity is available in the file gull_6tags_data.csv shared via Github (https://github.com/MarieAugerMethe/CANSSI_HMM_wk_dthon_2025). It cannot be used for publication/research without written permission. Please contact Marie Auger-Méthé (auger-methe@stat.ubc.ca) for more information.
The dataset contains the data of six glaucous-winged gulls, tagged on an island located off the coast of Vancouver Island. The data covers a period of one month in July 2023. It includes speed, GPS, and acceleration data.
# Read data
gulls <- read.csv("gull_6tags_data.csv")
# Format columns
gulls$UTC_datetime <- ymd_hms(gulls$UTC_datetime)
gulls$device_id <- as.factor(gulls$device_id)
head(gulls)
## device_id UTC_datetime Latitude Longitude speed_km.h acc_x acc_y acc_z
## 1 223280 2023-07-01 00:01:32 48.63405 -123.2886 0 -70 -542 900
## 2 223280 2023-07-01 00:16:36 48.63340 -123.2858 0 -107 -696 773
## 3 223280 2023-07-01 00:31:45 48.63330 -123.2869 1 -20 -678 813
## 4 223280 2023-07-01 00:47:05 48.63304 -123.2837 3 -30 98 868
## 5 223280 2023-07-01 01:01:33 48.63211 -123.2832 0 90 -612 836
## 6 223280 2023-07-01 01:16:39 48.63205 -123.2831 0 69 -734 797
## toxoplasmosis
## 1 0
## 2 0
## 3 0
## 4 0
## 5 0
## 6 0
The data was collected approximately every 15 minutes, though some times may be missing. This will need to be accounted for.
As you can see, the dataset contains these variables:
Let’s map the movement of the gulls
gulls_sf <- st_as_sf(gulls %>% filter(!is.na(Longitude)), coords = c("Longitude","Latitude"), remove=FALSE)
st_crs(gulls_sf) <- 4326 #Coordinate system: WGS 84
mapview(gulls_sf, zcol = "device_id",
layer.name=" ")